package com.gz.logistics.library.pojo;

import org.json.JSONArray;
import org.json.JSONException;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016-04-29.
 */
public class ClothesDetails implements Serializable {
    private String brand;
    private String labelno;
    private String colour;
    private double money;
    private String deliverydate;
    private String addtionalequire;
    private double addtionalmoney;
    private String clothesname;

    public String getClothesname() {
        return clothesname;
    }

    public void setClothesname(String clothesname) {
        this.clothesname = clothesname;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getLabelno() {
        return labelno;
    }

    public void setLabelno(String labelno) {
        this.labelno = labelno;
    }

    public String getColour() {
        return colour;
    }

    public void setColour(String colour) {
        this.colour = colour;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }

    public String getDeliverydate() {
        return deliverydate;
    }

    public void setDeliverydate(String deliverydate) {
        this.deliverydate = deliverydate;
    }

    public String getAddtionalequire() {
        return addtionalequire;
    }

    public void setAddtionalequire(String addtionalequire) {
        this.addtionalequire = addtionalequire;
    }

    public double getAddtionalmoney() {
        return addtionalmoney;
    }

    public void setAddtionalmoney(double addtionalmoney) {
        this.addtionalmoney = addtionalmoney;
    }

    public String getFavoritedeliverydate() {
        return favoritedeliverydate;
    }

    public void setFavoritedeliverydate(String favoritedeliverydate) {
        this.favoritedeliverydate = favoritedeliverydate;
    }

    private String favoritedeliverydate;
    public static List<ClothesDetails> parse(JSONArray jsonArray) throws JSONException {
        if (jsonArray == null || jsonArray.length() <= 0){
            return null;
        }
        List<ClothesDetails> detailses= new ArrayList<ClothesDetails>();
        for (int i = 0 ; i < jsonArray.length() ; i ++ ){
            ClothesDetails info = new ClothesDetails();
            info.brand = (jsonArray.getJSONObject(i)).getString("brand");
            info.labelno = (jsonArray.getJSONObject(i)).getString("label_no");
            info.colour = (jsonArray.getJSONObject(i)).getString("colour");
            info.money = (jsonArray.getJSONObject(i)).getDouble("money");
            info.deliverydate = (jsonArray.getJSONObject(i)).getString("delivery_date");
            info.addtionalequire = (jsonArray.getJSONObject(i)).getString("addtional_equire");
            info.addtionalmoney = (jsonArray.getJSONObject(i)).getDouble("addtional_money");
            info.favoritedeliverydate = (jsonArray.getJSONObject(i)).getString("favorite_delivery_date");
            info.clothesname = (jsonArray.getJSONObject(i)).getString("cloth_name");
            detailses.add(info);
        }
        return detailses;
    }
}
